$(document).ready(function(){
    $('ul#categories').treeview(
        {
            collapsed: true
        }
    );
        
    $(".rightclick").contextMenu({menu: 'myMenu'},
    function(action, el, pos) {
        if(action == 'add') {
//            var branches = $("<li><span class='folder'>New Sublist</span><ul>" + 
//                                    "<li><span class='file'>Item1</span></li>" + 
//                                    "<li><span class='file'>Item2</span></li></ul></li>").appendTo("#browser");
//            $("ul#categories").treeview({
//                    add: branches
//            });
            $(el).trigger('add', 'This is the name');
        }else {
            console.info(
                'Action: ' + action + '\n\n' +
                'Element ID: ' + $(el).attr('id') + '\n\n' + 
                'X: ' + pos.x + '  Y: ' + pos.y + ' (relative to element)\n\n' + 
                'X: ' + pos.docX + '  Y: ' + pos.docY+ ' (relative to document)'
            );
        }
    });
    
    $('.fileManagerHandler').fileManager();
});

